xen/arm: p2m: Prevent adding mapping when domain is dying
authorJulien Grall <jgrall@amazon.com>
Tue, 11 Oct 2022 12:52:13 +0000 (14:52 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 12:52:13 +0000 (14:52 +0200)
commit8d9531a3421dad2b0012e09e6f41d5274e162064
tree2f2816457d455af1285ca849443560269807aafd
parent4aa32912ebeda8cb94d1c3941e7f1f0a2d4f921b
xen/arm: p2m: Prevent adding mapping when domain is dying

During the domain destroy process, the domain will still be accessible
until it is fully destroyed. So does the P2M because we don't bail
out early if is_dying is non-zero. If a domain has permission to
modify the other domain's P2M (i.e. dom0, or a stubdomain), then
foreign mapping can be added past relinquish_p2m_mapping().

Therefore, we need to prevent mapping to be added when the domain
is dying. This commit prevents such adding of mapping by adding the
d->is_dying check to p2m_set_entry(). Also this commit enhances the
check in relinquish_p2m_mapping() to make sure that no mappings can
be added in the P2M after the P2M lock is released.

This is part of CVE-2022-33746 / XSA-410.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
Tested-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: 3ebe773293e3b945460a3d6f54f3b91915397bab
master date: 2022-10-11 14:20:18 +0200
xen/arch/arm/p2m.c